//
//  ITLoginNetworkAPIManager.m
//  ITBE
//
//  Created by ITBE on 2019/2/25.
//  Copyright © 2019 ITBE. All rights reserved.
//

#import "ITLoginNetworkAPIManager.h"

@implementation ITLoginNetworkAPIManager
+(instancetype)shareManager
{
    static ITLoginNetworkAPIManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[ITLoginNetworkAPIManager alloc] init];
    });
    return manager;
}

-(void)activationDeviceWithParams:(NSDictionary *)params callback:(APIRequstCallBack)callback
{
    [[ITNetWorkRequestManager shareManager] request:VT_ActivationDevice_API method:@"POST" parameters:params callback:callback isNotify:NO];
}

-(void)loginWithMobile:(NSString *)mobile checkCode:(NSString *)checkCode callback:(APIRequstCallBack)callback
{
    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:mobile,@"mobile",checkCode,@"verifycode", nil];
    [[ITNetWorkRequestManager shareManager] post:VT_Login_API parameters:parameters callback:callback isNotify:NO];
}

-(void)loginWithMobile:(NSString *)mobile password:(NSString *)password callback:(APIRequstCallBack)callback
{
    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:mobile,@"name",password,@"password", nil];
    [[ITNetWorkRequestManager shareManager] post:VT_Login_API parameters:parameters callback:callback isNotify:YES];
}

-(void)sendValidateCodeWithMobile:(NSString *)mobile rand:(NSString *)rand callback:(APIRequstCallBack)callback
{
    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:mobile,@"mobile",rand,@"rand", nil];
    [[ITNetWorkRequestManager shareManager] get:VT_ValidateCode_API parameters:parameters callback:callback isNotify:NO];
}

-(void)checkValidateCodeWithMobile:(NSString *)mobile code:(NSString *)code callback:(APIRequstCallBack)callback
{
    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:mobile,@"mobile",code,@"checkcode", nil];
    [[ITNetWorkRequestManager shareManager] post:VT_ValidateCheck_API parameters:parameters callback:callback isNotify:YES];
}

-(void)loginWithParams:(NSDictionary *)params callback:(APIRequstCallBack)callback
{
    [[ITNetWorkRequestManager shareManager] post:VT_Login_API parameters:params callback:callback isNotify:YES];
}

-(void)logoutCallback:(APIRequstCallBack)callback
{
    [[ITNetWorkRequestManager shareManager] get:VT_Logout_API parameters:nil callback:callback isNotify:NO];
}
@end
